home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
answrbok
/
4_8.lha
/
4_8
/
stack.h
< prev
Wrap
Text File
|
1993-08-08
|
914b
|
49 lines
* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
* The C++ Answer Book */
* Tony Hansen */
* All rights reserved. */
* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
* The C++ Answer Book */
* Tony Hansen */
* All rights reserved. */
/ stack.h
/ define a module of routines
/ which manipulate a stack
ifndef STACK_H
define STACK_H
ypedef int stacktype;
ypedef struct
{
int maxsize;
int curtop;
stacktype *mem;
} stack;
/ create a new stack
tack *newstack(int maxsize);
/ delete the stack
oid delstack(stack *s);
/ add val onto stack
oid push(stack *s, stacktype c);
/ return and remove top of stack
tacktype pop(stack *s);
/ return top of stack
tacktype top(stack *s);
/ empty the stack
nline void clearstack(stack *s)
s->curtop = 0;
/ see if stack is empty
nline int isempty(stack *s)
return s->curtop == 0;
endif /* STACK_H */